package www.wen.com.common.base

import android.app.Activity
import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass
import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import cafe.adriel.voyager.core.screen.Screen

abstract class BaseScreen<M:BaseScreenModel>: Screen {

    @OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
    @Composable
    override fun Content() {
        LocalConfiguration.current.screenWidthDp
        LocalConfiguration.current.screenHeightDp

        val windowSizeClass = calculateWindowSizeClass(activity = LocalContext.current as Activity)
        val isExpandedScreen = windowSizeClass.widthSizeClass == WindowWidthSizeClass.Expanded
        when(windowSizeClass.widthSizeClass){
          WindowWidthSizeClass.Compact->{}
          WindowWidthSizeClass.Medium->{}
          WindowWidthSizeClass.Expanded->{}
        }
        getModel()
    }

    @Composable
    abstract fun getModel():M

}


@Composable
fun provideO方向(){
    LocalConfiguration.current.screenHeightDp
    LocalConfiguration.current.screenWidthDp
}
